<%@ page pageEncoding="UTF-8"%>

<%@ taglib uri="/tags/struts-tiles" prefix="tiles"%>
<%@ taglib uri="/tags/struts-html" prefix="html"%>
<%@ taglib uri="/tags/struts-logic" prefix="logic"%>
<%@ taglib uri="/tags/struts-nested" prefix="nested"%>
<%@ taglib uri="/tags/struts-bean" prefix="bean"%>
<%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c"%>

<table class="table" layoutH="85" width="100%" id="tbl_flowseqs" beforeRender="table_sort();">
	<thead>
		<tr>
			<th align="center" width="55px">步骤序号</th>
			<th align="center">节点名称</th>
			<th align="center">节点标识</th>
			<th align="center">节点描述</th>
			<th align="center">审批角色</th>
			<th align="center" width="55px">必经节点</th>
			<th align="center" width="40px">需过会</th>
			<th align="center">预审环节</th>
			<th align="center">操作</th>
			<th align="center">编辑</th>
			<th align="center">删除</th>
		</tr>
	</thead>
	<tbody>
		<logic:present name="entity">
			<logic:iterate name="entity" property="templates" id="tpl" indexId="idx">
				<tr id="drole-${role.id}" ${idx % 2 == 1 ? 'style="background-color: #F5F5F5"' : ''}>
					<td>${tpl.sequence}</td>
					<td style="text-align:left">${tpl.nodeTitle}</td>
					<td style="text-align:left">${tpl.nodeKey}</td>
					<td style="text-align:left" title="${tpl.nodeDesc}">${tm:subString(tpl.nodeDesc, 50, '...')}</td>
					<td style="text-align:left">${tpl.toAuditRole.roleName}</td>
					<td style="text-align:center" class="apply_${tpl.mandatoryFlag}">${tpl.mandatoryFlag eq 1 ? '是' : '否'}</td>
					<td style="text-align:center" class="apply_${tpl.conferenceFlag}">${tpl.conferenceFlag eq 1 ? '是' : '否'}</td>
					<td style="text-align:center">${tpl.dependedFlow ne null ? tpl.dependedFlow.nodeTitle : '无'}</td>
					<td style="text-align:center">
						<c:choose>
							<c:when test="${tpl.sequence gt 3}">
								<a href="app/flow/def/template.do?action=actionShiftFlowSequence&offset=-1&id=${tpl.id}&src=SRC_PROCESS_TPL" 
									target="ajaxTodo" title="确定要上移该流程模板吗？" class="oplink" callback="ajaxDone_callback()">上移</a>
							</c:when>
							<c:otherwise>
								<label class="opdisabled" title="${tpl.sequence lt 3 ? '该环节不能进行上移操作' : '已经是最上面一个节点了噢'}">上移</label>
							</c:otherwise>
						</c:choose>
						&nbsp;
						<c:choose>
							<c:when test="${tpl.sequence lt fn:length(entity.templates) && tpl.sequence gt 2}">
								<a href="app/flow/def/template.do?action=actionShiftFlowSequence&offset=1&id=${tpl.id}&src=SRC_PROCESS_TPL" 
									target="ajaxTodo" title="确定要下移该流程模板吗？" class="oplink" callback="ajaxDone_callback()">下移</a>
							</c:when>
							<c:otherwise>
								<label class="opdisabled" title="${tpl.sequence lt 3 ? '该环节不能进行下移操作' : '已经是最下面一个节点了噢'}">下移</label>
							</c:otherwise>
						</c:choose>
					</td>
					<td style="text-align:center">
						<a href="app/flow/def/template.do?action=dialogFlowTemplatePage&id=${tpl.id}" mask="true" 
							target="dialog" title="`${tpl.nodeTitle}` - 节点编辑" height="380" class="oplink">编辑</a>
					</td>
					<td style="text-align:center">
						<c:choose>
							<c:when test="${tpl.sequence gt 2}">
								<a href="app/flow/def/template.do?action=actionRemoveFlowTemplate&id=${tpl.id}" 
									target="ajaxTodo" title="确定删除该流程模板吗？" class="oplink" callback="ajaxDone_callback()">删除</a>
							</c:when>
							<c:otherwise>
								<label class="opdisabled" title="`初审`和`复审环节不能被删除...`">删除</label>
							</c:otherwise>
						</c:choose>
					</td>
				</tr>
			</logic:iterate>
		</logic:present>
	</tbody>
</table>